package timing

import (
	"gin_chat_demo/config/zap"
	"gin_chat_demo/websocket"
)

func Online() websocket.HandlerFunc {
	return func(srv *websocket.Server, conn *websocket.Conn, msg *websocket.Message) {
		users := srv.GetUsers()
		err := srv.Send(websocket.NewMessage("server", users), conn)
		if err != nil {
			zap.Logger.Error(err)
		}
	}
}
